package  
{
		import net.flashpunk.Entity;
		import net.flashpunk.graphics.Spritemap;
		import net.flashpunk.Tween;
		import net.flashpunk.tweens.misc.VarTween;
		import net.flashpunk.FP;
	/**
	 * ...
	 * @author Donatello
	 */
	public class Explosion extends Entity
	{
		[Embed(source = "img/sheets/explosion2.png")]private const ANIM:Class;
		private var anim:Spritemap;
		
		private var tween:VarTween;
		
		private var time:Number=0.0;
		
		public function Explosion(px:Number,py:Number) 
		{
			anim = new Spritemap(ANIM, 320,240);
			anim.add("explosion", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,14], 10, false);
			
			graphic = anim;
			
			anim.scale=7
			
			anim.play("explosion");
			x = px;
			y = py;
			
			
			tween = new VarTween();
			addTween(tween);
			
		}
		
		
		
		override public function update():void
		{
			time += FP.elapsed;
			
			if (time >= 2)
				Vanish();
			
			
		}
		
		
		public function Vanish():void
		{
			tween.tween(anim, "alpha", 0,10);
			
		}
		
	}

}